package com.editso.haier.entity;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.*;
import java.sql.Timestamp;

@Entity
@Table
@Setter
@Getter
@NoArgsConstructor
public class ShoppingCar {

    /**
     * 编号
     * */
    @Id
    @Column
    private String orderCode;

    /**
     * 购买用户
     * */
    @ManyToOne
    @JoinColumn(name = "user_id")
    private User user;
    @Column(name = "user_id", nullable = false, insertable = false, updatable = false)
    private String userId;

    /**
     * 商品
     * */
    @ManyToOne
    @JoinColumn(name = "commodity_id")
    private Commodity commodity;
    @Column(name = "commodity_id", nullable = false, insertable = false, updatable = false)
    private String commodityId;

    /**
     * 购买数量
     * */
    @Column(nullable = false)
    private Integer count;

    @Column(nullable = false,
            insertable = false,
            updatable = false,
            columnDefinition = "datetime default now()")
    private Timestamp createDate;
}
